package day43;

import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int m = in.nextInt();
            ArrayList<Integer> arr = new ArrayList<>();
            int cerSum = 0;
            getSum(arr,1,cerSum,n,m);

        }
    }
    public static void getSum(ArrayList<Integer> arr, int pos, int curSum, int n, int dest) {
        if(curSum >= dest) {
            if(curSum == dest) {
                for(int i = 0; i < arr.size()-1 ;i++) {
                    System.out.print(arr.get(i) + " ");
                }
                System.out.println(arr.get(arr.size() - 1));
            }
            return;
        }
        for(int i = pos; i <= n; i++) {
            arr.add(i);
            getSum(arr, i+1, curSum + i, n, dest);
            arr.remove(arr.size() -1);
        }
    }
}